/**
  ******************************************************************************
  * @file    main.c
  * @author  Iron
  * @date    2018-08-03
  * @version v1.0
  * @brief   Control board Application
  */

/** @addtogroup GROUP_MAIN
  * @{
  */

/* includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include "FreeRTOS.h"
#include "task.h"
#include "bsp.h"
#include "bsp_led.h"
#include "bsp_watchdog.h"

/* private typedef -----------------------------------------------------------*/
/* private macro -------------------------------------------------------------*/
/* private variables ---------------------------------------------------------*/
/* private function prototypes -----------------------------------------------*/
/* private functions ---------------------------------------------------------*/

void MainTask( void* pvArgument )
{
  /* Configure the hardware ready to run the Application. */
  bsp_init();

  /* loop forever */
  for( ;; ) {
    vTaskDelay( pdMS_TO_TICKS( 50 ) );
    /* watchdog */
    bsp_watchdog_keepalive();
    /* system led blink */
    // led_toggle( LED_SYSTEM );
  }
}

/**
  * @brief  main
  * @param  None.
  * @retval OK: normally return;
  *         ERROR: error;
  */
int main( void )
{
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
  /* Configure the system clock */
  SystemClock_Config();
  /* Create the thread(s) */
  xTaskCreate( MainTask, "MainTask", 256, NULL, 6, NULL );
  /* Start the scheduler. */
  vTaskStartScheduler();
  /* If all is well, the scheduler will now be running, and the following line
  will never be reached.  If the following line does execute, then there was
  insufficient FreeRTOS heap memory available for the idle and/or timer tasks
  to be created.  See the memory management section on the FreeRTOS web site
  for more details. */
  for( ;; );
}


/**
  * @}
  */

/******************* (C)COPYRIGHT 2018 ***** END OF FILE *********************/
